package com.cscec5b.inspection.controller;

import jakarta.servlet.http.HttpSession;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.Map;

public class debug {
    @GetMapping("/api/debug/session")
    public Map<String, Object> debug(HttpSession s,
                                     @RequestHeader(value="X-Auth-Token", required=false) String sid) {
        return Map.of(
                "incomingSid", sid,
                "serverSessionId", s!=null ? s.getId() : null,
                "USER_CODE", s!=null ? s.getAttribute("USER_CODE") : null
        );
    }
}
